// pages/shopMine/shopMine.js

var app = getApp();
var model = require('../../utils/model/model.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    httpApiImg: app.globalData.httpApiImg,
    imgUrl: app.globalData.imageUrl,
    userInfo: '',
    serviceData: [
      { txt: '我的收藏', imgurl: app.globalData.imageUrl + "my_my_ collection@2x.png", url: '/pages/myCollection/myCollection' },
      // { txt: '待收款', imgurl: app.globalData.imageUrl + "daishoukuan@2x.png", url: '/pages/myOrder/myOrder?type=none' }
    ],
    isSign: false,
    isShop:'',
    bottabData: app.globalData.bottabDataForPpsj,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      isShop: wx.getStorageSync('isShop'),
      ['bottabData[4].current']: true,
      userInfo:JSON.parse(wx.getStorageSync('userInfo'))
    })
  },
  switchBotab(e) {
    let isShop = wx.getStorageSync("isShop");
    let isOut = wx.getStorageSync("isOut"); 
    if (isShop == 1 && e.currentTarget.dataset.value == '入驻') {
      if (isOut == 1) {
        wx.showModal({
          title: '提示',
          content: '您的店铺已到期，请续费',
          showCancel: false,
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/shopIndex/shopIndex?whole=1'
              })
            }
          }
        })
      }
      else {
        wx.navigateTo({
          url: '/pages/sjwppublish/sjwppublish'
        })
      }
    }
    else if (isShop == 2 && e.currentTarget.dataset.value == '入驻') { }
    else {
      wx.navigateTo({
        url: e.currentTarget.dataset.url
      })
    }
  },
  // 进入我的订单页面
  openPage: function(){
    wx.navigateTo({
      url: '/pages/myOrder/myOrder',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})